package cn.mjnxin.iot.connector.handle;

import cn.mjnxin.iot.connector.message.IMessage;
import cn.mjnxin.iot.connector.message.IMessageHandle;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInboundHandler;

/**
 * 抽象工厂
 * @author CLG 2023年10月10日
 * @version V1.0.0
 */
public interface IHandleFactory {
    void initAllMessageHandle(Integer[] pidArray);

    void registMessageHandle(IMessageHandle<? extends IMessage<?>> messageHandle);

    IMessageHandle<? extends IMessage<?>> getMessageHandle(Integer pid);

    ByteBuf getLoginBuf(Integer gateNo, Integer pid, String localAddress, boolean mngMode, boolean isAllMatch) throws Exception;
    
    ChannelHandler[] getChannelHandlers(ChannelInboundHandler thisHandle, Integer pid, Integer logLevel, boolean isAllMatch);
    
    void startMQListener();
    
    void stopMQListener();

	void onConnectSuccess(String ip, Integer port, Integer pid);

	void onConnectFailed(String ip, Integer port, Integer pid);
}
